package com.ruoyi.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.admin.AdminRichTextDB;
import com.ruoyi.system.service.admin.AdminRichTextService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/app/contentDetail")
@Slf4j
public class ContentDetailController {

    @Resource

    private AdminRichTextService adminRichTextService;

    @GetMapping("/{id}")
    public AjaxResult getDetail(@PathVariable("id") Long id){
        AdminRichTextDB adminRichTextDB = adminRichTextService.selectAdminRichTextById(id);
        return AjaxResult.success(adminRichTextDB);
    }

    @GetMapping("/getDetailListByLastId")
    public AjaxResult getDetailListByLastId(@RequestParam(required = false) Long id){
        List<AdminRichTextDB> list = adminRichTextService.getDetailListByLastId(id);
        return AjaxResult.success(list);
    }

//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id) {
//        return success(adminRichTextService.selectAdminRichTextById(id));
//    }

}
